[339] Rename plantWoodCStorageDelta to plantWoodCAccountingDelta#344
[339] Rename plantWoodCStorageDelta to plantWoodCAccountingDelta#344ANAMASGARD wants to merge 4 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR renames SIPNET’s internal “wood storage delta” field to clarify that it is an accounting term (carbon not coupled to nitrogen), and propagates the rename through outputs, restart serialization, tests, and docs.
Changes:
- Renamed
plantWoodCStorageDelta→plantWoodCAccountingDeltaacross model code and tests. - Renamed the
sipnet.outcolumnnppStorage→plantWoodCAccountingDeltaand updated smoke-check tooling and golden outputs. - Added backward-compatible restart reading for legacy checkpoints using
envi.plantWoodCStorageDelta.
Reviewed changes
Copilot reviewed 17 out of 18 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| tools/smoke_check.py | Updates expected output column list to match the renamed output field. |
| tests/smoke/russell_4/sipnet.out | Updates smoke-test golden output header for the renamed column. |
| tests/sipnet/test_restart_infrastructure/mock_state.c | Updates restart infra test scaffolding for the renamed environment field. |
| tests/sipnet/test_events_types/testEventHarvest.c | Updates event test initialization to the renamed environment field. |
| src/sipnet/state.h | Renames the environment struct field and clarifies its meaning in comments. |
| src/sipnet/sipnet.c | Renames output column header and replaces all uses of the old field name. |
| src/sipnet/restart.c | Writes restart checkpoints with the new key and reads legacy checkpoints with the old key. |
| src/sipnet/events.c | Updates harvest event calculations to use the renamed field. |
| src/sipnet/balance.c | Updates mass-balance totals and clarifies nitrogen accounting comment. |
| docs/user-guide/model-outputs.md | Documents the new output column name and the prior name. |
| docs/parameters.md | Updates parameter documentation to the new accounting-delta terminology. |
| docs/model-structure.md | Updates model-structure narrative/equations to reflect accounting delta terminology. |
| docs/developer-guide/restart-checkpoint.md | Documents backward-compatible restart key handling post-rename. |
| docs/CHANGELOG.md | Adds changelog entry describing the rename and restart compatibility behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| #define RESTART_SCHEMA_VERSION "1.0" | ||
| #define RESTART_FLOAT_EPSILON 1e-8 | ||
| #define LEGACY_ENVI_PLANT_WOOD_C_STORAGE_DELTA "envi.plantWoodCStorageDelta" | ||
| #define ENVI_PLANT_WOOD_C_ACCOUNTING_DELTA_INDEX 12 |
| state->enviPF[10] = (StateField){"envi.litterN", FT_DOUBLE, &envi.litterN, 0}; | ||
| state->enviPF[11] = (StateField){"envi.plantStorageN", FT_DOUBLE, &envi.plantStorageN, 0}; | ||
| state->enviPF[12] = (StateField){"envi.plantWoodCStorageDelta", FT_DOUBLE, &envi.plantWoodCStorageDelta, 0}; | ||
| state->enviPF[12] = (StateField){"envi.plantWoodCAccountingDelta", FT_DOUBLE, &envi.plantWoodCAccountingDelta, 0}; |
There was a problem hiding this comment.
I don't think we want to support the legacy key
There was a problem hiding this comment.
Agreed, it has not been around long enough (and is an internal detail)
| if (setLegacyPlantWoodCAccountingDelta( | ||
| restartIn, key, value, | ||
| &state->enviPF[ENVI_PLANT_WOOD_C_ACCOUNTING_DELTA_INDEX])) { |
There was a problem hiding this comment.
I don't think we want to support the legacy key
|
|
||
| fprintf(out, "%4d %3d %5.2f %10.2f %10.2f %12.2f ", year, day, time, | ||
| (envi.plantWoodC + envi.plantWoodCStorageDelta), envi.plantLeafC, | ||
| (envi.plantWoodC + envi.plantWoodCAccountingDelta), envi.plantLeafC, |
There was a problem hiding this comment.
For legacy reasons, I think we want to leave that column named plantWoodC.
As for nppStorage, since it is a debug column, I'd like something shorter. How about just cnDelta
dlebauer
left a comment
There was a problem hiding this comment.
@ANAMASGARD - thank you for your contribution!
I made a few comments, but will defer to @Alomir to determine what, if anything, should be changed before merging.
| state->enviPF[10] = (StateField){"envi.litterN", FT_DOUBLE, &envi.litterN, 0}; | ||
| state->enviPF[11] = (StateField){"envi.plantStorageN", FT_DOUBLE, &envi.plantStorageN, 0}; | ||
| state->enviPF[12] = (StateField){"envi.plantWoodCStorageDelta", FT_DOUBLE, &envi.plantWoodCStorageDelta, 0}; | ||
| state->enviPF[12] = (StateField){"envi.plantWoodCAccountingDelta", FT_DOUBLE, &envi.plantWoodCAccountingDelta, 0}; |
There was a problem hiding this comment.
I don't think we want to support the legacy key
| if (setLegacyPlantWoodCAccountingDelta( | ||
| restartIn, key, value, | ||
| &state->enviPF[ENVI_PLANT_WOOD_C_ACCOUNTING_DELTA_INDEX])) { |
There was a problem hiding this comment.
I don't think we want to support the legacy key
Per review on PecanProject#344: do not read envi.plantWoodCStorageDelta from checkpoints. Update docs and add test that the obsolete key is rejected.
|
Thanks @dlebauer for the review — addressed in this new commit
Left the |
Alomir
left a comment
There was a problem hiding this comment.
Great work! Some minor tweaks suggested, a few looking for input from @dlebauer.
Also - please run the smoke_check utility and include the results (as an attached file) in the PR description. Use this command:
python tools/smoke_check.py run verbose base > smoke_check.txt
| | | $C_{\text{wood,accounting}}$ | plantWoodCAccountingDelta | Wood carbon accounting delta (N-lag term; not N-coupled structural wood) | g C m$^{-2}$ | | ||
|
|
||
| Note: this column was previously named `nppStorage`. |
There was a problem hiding this comment.
I appreciate trying to update the docs! However, this is a debug-only column that will likely be removed before our final deadline.
@dlebauer : do you think this column is worth documenting?
There was a problem hiding this comment.
Also - the plantWoodC row needs a tweak to indicate that it is the total of "regular" plantWoodC and the accounting term. This might be best with a footnote, like soilWetnessFrac.
| Starting in SIPNET v2.1, to support mass balance tracking, this storage is explicitly tracked as a separate pool called | ||
| $C_{\text{wood,storage}}$, which is initialized to zero. We can represent this storage of carbon as: | ||
| Starting in SIPNET v2.1, to support mass balance tracking, this term is explicitly tracked as | ||
| $C_{\text{wood,accounting}}$ (`plantWoodCAccountingDelta`), which is initialized to zero. We can represent this |
There was a problem hiding this comment.
| $C_{\text{wood,accounting}}$ (`plantWoodCAccountingDelta`), which is initialized to zero. We can represent this | |
| $C_{\text{wood,accounting}}$, which is initialized to zero. We can represent this |
We don't include internal naming in this doc
There was a problem hiding this comment.
@dlebauer : suggestions for the subscript here? accounting is accurate in some sense, but perhaps not the best descriptor. 'non-N', or some such, maybe?
|
|
||
| fprintf(out, "%4d %3d %5.2f %10.2f %10.2f %12.2f ", year, day, time, | ||
| (envi.plantWoodC + envi.plantWoodCStorageDelta), envi.plantLeafC, | ||
| (envi.plantWoodC + envi.plantWoodCAccountingDelta), envi.plantLeafC, |
There was a problem hiding this comment.
For legacy reasons, I think we want to leave that column named plantWoodC.
As for nppStorage, since it is a debug column, I'd like something shorter. How about just cnDelta
| print("Comparing common columns") | ||
| else: | ||
| cols = 'year day time plantWoodC plantLeafC woodCreation soil coarseRootC fineRootC litter soilWater soilWetnessFrac snow npp nee cumNEE gpp rAboveground rSoil rRoot ra rh rtot evapotranspiration fluxestranspiration minN soilOrgN litterN n2o nLeaching nFixation nUptake ch4 nppStorage bcdeltaC bcdeltaN' | ||
| cols = 'year day time plantWoodC plantLeafC woodCreation soil coarseRootC fineRootC litter soilWater soilWetnessFrac snow npp nee cumNEE gpp rAboveground rSoil rRoot ra rh rtot evapotranspiration fluxestranspiration minN soilOrgN litterN n2o nLeaching nFixation nUptake ch4 plantWoodCAccountingDelta bcdeltaC bcdeltaN' |
The wood N-lag term is an accounting delta for carbon not coupled to nitrogen, not a storage pool. Renames the Envi field, sipnet.out column (was nppStorage), restart key, and docs; legacy restart keys remain readable.
Per review on PecanProject#344: do not read envi.plantWoodCStorageDelta from checkpoints. Update docs and add test that the obsolete key is rejected.
9b3e7db to
a03a481
Compare
Rename sipnet.out debug column to cnDelta per maintainer feedback while keeping internal/restart key plantWoodCAccountingDelta. Add plantWoodC footnote, remove debug column from user docs, and fix ch4/cnDelta spacing.
|
@Alomir and @dlebauer I have addressed remaining review feedbacks :
Ready for re-review @Alomir |
Summary
FIXES #339.
Issue #339 refers to
plantWoodStorageC; the actual SIPNET identifier wasplantWoodCStorageDelta(output column:nppStorage). This PR renames the internal state/restart field toplantWoodCAccountingDeltato reflect that it tracks carbon changes with no associated nitrogen (NPP averaging lag / bookkeeping), not a storage pool.No change to model equations or numeric results — rename and output formatting only.
Changes (including maintainer review feedback)
plantWoodCStorageDelta→plantWoodCAccountingDelta(envi.plantWoodCAccountingDeltain checkpoints). Legacyenvi.plantWoodCStorageDeltakeys are rejected (no backward compatibility).sipnet.outdebug column:nppStorage→cnDelta(shorter debug-only name per review). Internal field name unchanged.plantWoodCcolumn: name unchanged; reports total wood C (structural + accounting term).plantWoodCfootnote [^2] in model-outputs; debug column removed from user docs; internal code names removed from model-structure prose; CHANGELOG updated.Test plan
make testbuildmake unit(21/21 pass, includingtestOutputHeaderand restart suite)make smoke(5/5 sipnet; baselines updated forcnDeltacolumn padding)make testpython tools/smoke_check.py run verbose base(results below)smoke_check results
Full output also saved locally as
smoke_check.txtat repo root.Review responses
plantWoodCAccountingDeltatocnDelta; internal field/restart key unchanged.model-outputs.mdas debug-only.a03a481).